package controllers

import (
	"github.com/goravel/framework/contracts/http"
	"github.com/goravel/framework/facades"
	httpfacade "github.com/hulutech-web/http_result"
	"goravel/app/models"
)

type ProcessStateController struct {
	//Dependent services
}

func NewProcessStateController() *ProcessStateController {
	return &ProcessStateController{
		//Inject services
	}
}

// List ============ 1、流程选择.
// @Summary store department
// @Description 后台开单.
// @Tags ProcessStateController
// @Security BearerAuth
// @Accept json
// @Produce json
// @Id ProcessStateList
// @Param Authorization header string true "Bearer token"
// @Param processStateData body interface{} true "processStateData"
// @Success 200 {object} common.SuccessResponse "Successfully retrieved Menus ."
// @Failure 500 {object} common.ErrorResponse "Internal server error."
// @OperationID ProcessStateList
// @Router /api/admin/process_state/list [post]
func (r *ProcessStateController) List(ctx http.Context) http.Response {
	type_name := ctx.Request().Input("type")
	states := []models.ProcessState{}
	facades.Orm().Query().Model(&models.ProcessState{}).Where("type=?", type_name).Find(&states)
	return httpfacade.NewResult(ctx).Success("", states)
}
